﻿using System;

namespace JieCheng
{
    class JieCheng
    {
        public int Jc(int num)
        {
            return num > 0 ? num * Jc(num - 1) : 1; // 如果num>0则返回num *Jc(num - 1)，否则返回1
        }
    }

    class ExecuteJieCheng
    {
        static void Main(string[] args)
        {
            JieCheng n = new JieCheng();
            Console.Write("请输入一个数字，计算该数字的阶乘：");
            int result = n.Jc(Convert.ToInt32(Console.ReadLine()));
            Console.WriteLine("result is {0}", result);
            Console.ReadKey();
        }
    }
}